package com.linkage.seapeak.utils;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomSheetDialog;
import android.text.TextUtils;
import android.widget.CheckBox;
import android.widget.LinearLayout;

import com.linkage.jz.bankruptcy.R;

public class ProfileListBottomSheetDialog extends BottomSheetDialog {

    Context context;
    private CheckBox proXm;
    private CheckBox proJd;
    private CheckBox proZq;
    private CheckBox proBj;
    private CheckBox proTl;
    private CheckBox proRw;
    private CheckBox proGs;

    public ProfileListBottomSheetDialog(@NonNull Context context) {
        super(context);
        init(context);
    }

    public ProfileListBottomSheetDialog(@NonNull Context context, int theme) {
        super(context, theme);
        init(context);
    }

    protected ProfileListBottomSheetDialog(@NonNull Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        init(context);
    }

    private void init(Context context) {
        this.context = context;
        setContentView(R.layout.dialog_profile_list);
        initView();
    }

    private void initView() {
        proXm = (CheckBox) findViewById(R.id.pro_xm);
        proJd = (CheckBox) findViewById(R.id.pro_jd);
        proZq = (CheckBox) findViewById(R.id.pro_zq);
        proBj = (CheckBox) findViewById(R.id.pro_bj);
        proTl = (CheckBox) findViewById(R.id.pro_tl);
        proRw = (CheckBox) findViewById(R.id.pro_rw);
        proGs = (CheckBox) findViewById(R.id.pro_gs);
    }

    /**
     * 获取
     * @return
     */
    public String getListString() {
        String str = "";
        str += proXm.isChecked() ? ",0" : "";
        str += proJd.isChecked() ? ",1" : "";
        str += proZq.isChecked() ? ",2" : "";
        str += proBj.isChecked() ? ",3" : "";
        str += proTl.isChecked() ? ",4" : "";
        str += proRw.isChecked() ? ",5" : "";
        str += proGs.isChecked() ? ",6" : "";
        if (!TextUtils.isEmpty(str))
            str = str.substring(1);
        return str;
    }
}
